<#include "../base.ftl"/>
<#macro cssfile>
</#macro>

<#macro scriptfile>
</#macro>

<#macro breadcrumb>
    <ul class="breadcrumb">
     <#include "../crumb.ftl"/>
     <li class="active">船舶信息</li>
    </ul>
</#macro>

<#macro title>
广大物流云平台
</#macro>

<#macro jsscript>
jQuery(document).ready(function(){
    jQuery("#gridTable").jqGrid({
        url: '${request.contextPath}/list!list.action',
        editurl: '${request.contextPath}/operator.action',
        datatype:"json",
        mtype:'POST',
        height: 270,
        autowidth: true,
        colNames: [
                    '船舶编号',
                    '船舶代码',
                    '名称',
                    '类型',
                    '船级',
                    '船籍港',
                    '船员定额',
                    '船速',
                    '海关编号',
                    '船舶呼号',
                    'IMO编号',
                    '总长',
                    '型宽',
                    '型深',
                    '垂线间长',
                    '满载吃水',
                    '夏季干舷',
                    '船体材料',
                    '建造日期',
                    '所属船东',
                    '状态'
                    ],
        colModel:[
        {
                name : 'shippingId',
                jsonmap : 'SHIPPING_ID',
                index : 'SHIPPING_ID',
                hidden:false, 
                editable : false,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name : 'shippingCode',
                jsonmap : 'SHIPPING_CODE',
                index : 'SHIPPING_CODE',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'shippingName',
                jsonmap : 'SHIPPING_NAME',
                index : 'SHIPPING_NAME',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'shippingType',
                jsonmap : 'SHIPPING_TYPE',
                index : 'SHIPPING_TYPE',
                editable : true,
                edittype: "select",
                editoptions:{value:"0:集装箱船;1:滚装船;2:载驳船"},
                editrules:{required:true}     
        },{
                name : 'shippingLevel',
                jsonmap : 'SHIPPING_LEVEL',
                index : 'SHIPPING_LEVEL',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'registryPort',
                jsonmap : 'REGISTRY_PORT',
                index : 'REGISTRY_PORT',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'crewNum',
                jsonmap : 'CREW_NUM',
                index : 'CREW_NUM',
                editable: true,
                editrules:{required:true}
        },{
                name : 'shipSpeed',
                jsonmap : 'SHIP_SPEED',
                index : 'SHIP_SPEED',
                editable : true,
                editrules:{required:true}    
        },{
                name: 'customsNo', 
                jsonmap: 'CUSTOMS_NO', 
                index:'CUSTOMS_NO', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'callSign', 
                jsonmap: 'CALL_SIGN', 
                index:'CALL_SIGN', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'imoNo', 
                jsonmap: 'IMO_NO', 
                index:'IMO_NO', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'shipLength', 
                jsonmap: 'SHIP_LENGTH', 
                index:'SHIP_LENGTH', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'shipWidth', 
                jsonmap: 'SHIP_WIDTH', 
                index:'SHIP_WIDTH', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'shipDepth', 
                jsonmap: 'SHIP_DEPTH', 
                index:'SHIP_DEPTH', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'shipLpp', 
                jsonmap: 'SHIP_LPP', 
                index:'SHIP_LPP', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'loadedDraft', 
                jsonmap: 'LOADED_DRAFT', 
                index:'LOADED_DRAFT', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name : 'summerFreeboard',
                jsonmap : 'SUMMER_FREEBOARD',
                index : 'SUMMER_FREEBOARD',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'shipMaterial',
                jsonmap : 'SHIP_MATERIAL',
                index : 'SHIP_MATERIAL',
                editable : true,
                editrules:{required:true}    
        },{
                name : 'buildDate',
                jsonmap : 'BUILD_DATE',
                index : 'BUILD_DATE',
                editable : true,
                formatter : 'date',
                formatoptions : {srcformat : 'Y/m/d',newformat : 'Y-m-d'},
                editoptions :  {dataInit: function(element) {
                     $(element).datepicker({changeMonth : true,changeYear : true,dateFormat : 'yy-mm-dd'});
                }}
        },{
                name: 'ownerId', 
                jsonmap: 'OWNER_ID', 
                index:'OWNER_ID', 
                editable: true,
                searchoptions : {sopt : [ "eq", "cn"]}
        },{
                name: 'status', 
                jsonmap: 'STATUS', 
                index:'STATUS', 
                editable: false,
                hidden:true,
                searchoptions : {sopt : [ "eq", "cn"]}
        }],
            sortname: 'SHIPPING_ID',
            sortorder: 'desc',
            viewrecords: true,
            gridview: true,
            rownumbers : true,
            rowNum: 20,
            rowList: [10,20,30],
            pager : "#gridPager",
            jsonReader : {
                //固化定义
                page : "page.pageNo",
                total : "page.totalPages",
                records : "page.totalCount",
                root : "page.result",
                repeatitems : false,
                //设置主Key
                id : 'SHIPPING_ID'
                },
            prmNames:{
                    rows:"page.pageSize",
                    page:"page.pageNo",
                    sort:"page.orderBy",
                    order:"page.order"},
            pager: "#gridPager",
            loadBeforeSend : function(xhr,settings) {
                //设定访问的list标签
                settings.data = settings.data + "&gridKey=/list#TsmShipping";
                return true;
            },
            pager : "#gridPager",
            caption : "船舶列表"
            }).navGrid('#gridPager', {
             edit: true,
             add: true,
             del: true,
             search: true
        }, {
            //edit
            beforeShowForm: function(form) {},
            reloadAfterSubmit : true,
            closeAfterEdit : true, //修改完毕后关闭
            afterComplete : opertaionPrompt,
            //设定beanName
            onclickSubmit :setBeanName
        }, {
            //add
            beforeShowForm: function(form) {},
            reloadAfterSubmit : true,
            closeAfterAdd : true, //新增完毕后关闭
            afterComplete : opertaionPrompt,
            //设定beanName
            onclickSubmit :setBeanName,
            //提交前进行验证
            beforeSubmit :validateSumbit 
        }, {
            //del
            //设定beanName
            onclickSubmit :setBeanName,
            reloadAfterSubmit : true,
            afterComplete : opertaionPrompt
        }, {
            //组合查询
            multipleSearch : true
        });
    
        function setBeanName(){
            var add_data = new Object();
            add_data["beanName"] = "tsm.TsmShipping";
            return add_data;
        }
        
        //提交前的验证，检验数据，并加入beanName
        function validateSumbit(postdata, formid){
            return [true,''];
        }
});
</#macro>

<#macro main>
        <table id="gridTable"></table>
        <div id="gridPager"></div>
</#macro>